<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/10/30
 * Time: 10:41
 */

namespace app\pipeline\validate;


use think\Validate;

class Pipe extends Validate
{
    // 定义验证规则
    protected $rule = [
        'name|管道名称' => 'require|unique:equipment',
        'number|管道编号'  => 'require|unique:equipment',
        'company_id|设备所属公司'      => 'require',
        '__token__'    => 'require|token',
    ];

    // 定义验证提示
    protected $message = [
        'name.require' => '管道名称不能为空',
        'name.unique' => '管道名称重复,请重新输入',
        'number.require'    => '管道编号不能为空',
        'number.unique'     => '管道编号重复,请重新输入',
        'company_id.require' => '管道归宿管理公司不能为空',
        '__token__.token'  => '令牌数据无效，请刷新页面',
    ];

    //    // 定义验证场景
//    protected $scene = [
//        //更新
//        'update'  =>  ['email', 'password' => 'length:6,20', 'mobile', 'role', '__token__'],
//        //登录
//        'signin'  =>  ['username' => 'require', 'password' => 'require'],
//    ];
}